﻿@model IEnumerable<CREAPA.Dominio.OS>

@{
    ViewBag.Title = "ListaPendentes";
    Layout = "~/Views/Shared/_LayoutSemTopo.cshtml";
}

<h2>OS Pendentes de Análise (@ViewBag.TotalOS)</h2>

<script>setTimeout("window.location.reload();", 600000);</script>
<style type="text/css">
.webgrid-table{
    border : 1px solid #809FFF;
    background-color: white;
    border-collapse: collapse; 
    border: 1px solid black; 
}

.webgrid-table td, th {
    border:1px solid black;
    padding: 3px 7px 2px;

    }

.webgrid-header{
    background-color: #111839;
    color: white;
}

.webgrid-header a{
    color: white;
    text-decoration: none;
}

.webgrid-footer{
    
}

.webgrid-row-style {

padding: 3px 7px 2px;

    }

.webgrid-alternating-row{
    background-color: #b7c3f6;
}
</style>


@{
    WebGrid grid = new WebGrid(source: Model, columnNames: new string[] { "Id", "Problema", "Descricao", "DataCadOs", "PessoaInteressado", "Prioridade"}, canPage: true, rowsPerPage: 50);
}
<div id="content">
@grid.GetHtml( tableStyle: "webgrid-table",
        alternatingRowStyle: "webgrid-alternating-row",
        headerStyle: "webgrid-header",
        footerStyle: "webgrid-footer",
        rowStyle:"webgrid-row-style",
        mode: WebGridPagerModes.FirstLast | WebGridPagerModes.NextPrevious,
        firstText: "Primeiro",
        previousText: "Anterior",
        nextText: "Próximo",
        lastText: "Último",columns: grid.Columns(
              grid.Column("Id", header:"Número", format: @<text><center>@item.Id</center></text>),
              grid.Column("Problema", header:"Problema", format: @<text>@item.Problema</text>),           
              grid.Column("Descricao", header:"Descrição", format: @<text><div style='width: 20em;'>@item.Descricao</div></text>),
              grid.Column("DataCadOs", header:"Data de Cadastro", format: @<text>@item.DataCadOs</text>),
              grid.Column("PessoaInteressado", header:"Interessado", format: @<text>@item.PessoaInteressado</text>),
              grid.Column("Prioridade", header:"Prioridade", format: @<text>@item.Prioridade</text>) 
           )
)
</div>
<script src="~/Scripts/TabelBackgroundColor.js"></script>
<script>
    $(document).ready(function () {
        $("#content tbody tr").each(function (i, Column) {
            
            var prioridade = $(this).find("td:nth-child(6)").html();
            
            //check if its greater than zero
            if (prioridade == 'Alta') {
                //change the color of the text to green if its a positive number
                $(this).find("td:nth-child(1)").css("background-color", "#EE2C2C");
                $(this).find("td:nth-child(2)").css("background-color", "#EE2C2C");
                $(this).find("td:nth-child(3)").css("background-color", "#EE2C2C");
                $(this).find("td:nth-child(4)").css("background-color", "#EE2C2C");
                $(this).find("td:nth-child(5)").css("background-color", "#EE2C2C");
                $(this).find("td:nth-child(6)").css("background-color", "#EE2C2C");
            }
            //else if (prioridade = 'Média') {
            //    //change the color of the text to red if its a negatice number
            //    $(this).find("td:nth-child(1)").css("background-color", "#EEEE00");
            //    $(this).find("td:nth-child(2)").css("background-color", "#EEEE00");
            //    $(this).find("td:nth-child(3)").css("background-color", "#EEEE00");
            //    $(this).find("td:nth-child(4)").css("background-color", "#EEEE00");
            //    $(this).find("td:nth-child(5)").css("background-color", "#EEEE00");
            //    $(this).find("td:nth-child(6)").css("background-color", "#EEEE00");
            //}
        });
    });
</script>



<br /><br />
@Html.ActionLink("Voltar", "ListaPendentes",null,new { @class = "button2" })
<br /><br />
<h2>Estatística de OS no Mês</h2>

@{
    WebGrid grid2 = new WebGrid(ViewBag.ListaDeOsEst, columnNames: new string[] { "Janeiro", "Fevereiro", "Março", "Abril" }, canPage: true, rowsPerPage: 50);
}

@grid2.GetHtml( tableStyle: "table2",
        alternatingRowStyle: "alternate2",
        headerStyle: "header2",
        footerStyle: "footer2",
        mode: WebGridPagerModes.FirstLast | WebGridPagerModes.NextPrevious,
        firstText: "Primeiro",
        previousText: "Anterior",
        nextText: "Próximo",
        lastText: "Último",columns: grid2.Columns(              
              grid2.Column("Fevereiro", header:"Total de OS", format: @<text><center><div style='width: 10em'><font size="20">@item.Fevereiro</font></div></center></text>),              
              grid2.Column("Março", header:"Total de OS no Prazo", format: @<text><center><div style='width: 13em'><font size="20">@item.Março</font></div></center></text>),
                grid2.Column("Maio", header:"Total de OS fora do Prazo", format: @<text><center><div style='width: 13em'><font size="16">@item.Maio</font></div></center></text>),
                grid2.Column("Janeiro", header:"Percentual no Prazo", format: @<text><center><div style='width: 12em'><font size="20" color="green">@item.Janeiro%</font></div></center></text>),
                grid2.Column("Junho", header:"Total OS Encerrada com Avaliação", format: @<text><center><div style='width: 10em'><font size="20">@item.Junho</font></div></center></text>) ,
              grid2.Column("Abril", header:"Percentual Satisfação", format: @<text><center><div style='width: 10em'><font size="20">@item.Abril%</font></div></center></text>)  
	          
           )
)



